package com.cw.controller;

import com.cw.common.api.ResultObject;
import com.cw.dto.PrepayinDTO;
import com.cw.service.AppointmentByHandService;
import com.cw.service.IThisIiPrepayinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = {"日间病房预约-医生端"})
@RestController
@RequestMapping("/DayTimeWardAppointment")
public class AppointmentByHandController {

    @Autowired
    private AppointmentByHandService targetService;

    @Autowired
    private IThisIiPrepayinService iThisIiPrepayinService;

    @ApiOperation("手工预约-查询")
    @GetMapping("/queryPatientByIdenNo")
    public ResultObject queryPatientByIdenNo(@RequestParam String idenNo,@RequestParam String name){
        if (idenNo == null || idenNo.length()>=19){
            return ResultObject.errorReturn("身份证号码输入有误");
        }
        return ResultObject.successReturn(targetService.queryPatientByIdenNo(idenNo,name));
    }

    @ApiOperation("手工预约-提交")
    @GetMapping("/appointmentByHand")
    public ResultObject appointmentByHand(@RequestBody PrepayinDTO prepayinDTO) throws Exception {
        return iThisIiPrepayinService.insertIiPrepayin(prepayinDTO);
    }


}
